// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.core.skinnedmodel.population;

import java.util.List;
import zombie.core.Color;
import zombie.core.ImmutableColor;
import zombie.util.LocationRNG;

public final class OutfitRNG {
    private static final ThreadLocal<LocationRNG> RNG = ThreadLocal.withInitial(LocationRNG::new);

    public static void setSeed(long seed) {
        ((LocationRNG)RNG.get()).setSeed(seed);
    }

    public static long getSeed() {
        return ((LocationRNG)RNG.get()).getSeed();
    }

    public static int Next(int max) {
        return ((LocationRNG)RNG.get()).nextInt(max);
    }

    public static int Next(int min, int max) {
        if (max == min) {
            return min;
        } else {
            if (min > max) {
                int int0 = min;
                min = max;
                max = int0;
            }

            int int1 = ((LocationRNG)RNG.get()).nextInt(max - min);
            return int1 + min;
        }
    }

    public static float Next(float min, float max) {
        if (max == min) {
            return min;
        } else {
            if (min > max) {
                float _float = min;
                min = max;
                max = _float;
            }

            return min + ((LocationRNG)RNG.get()).nextFloat() * (max - min);
        }
    }

    public static boolean NextBool(int invProbability) {
        return Next(invProbability) == 0;
    }

    public static <E> E pickRandom(List<E> list) {
        if (list.isEmpty()) {
            return null;
        } else if (list.size() == 1) {
            return (E)list.get(0);
        } else {
            int _int = Next(list.size());
            return (E)list.get(_int);
        }
    }

    public static ImmutableColor randomImmutableColor() {
        float float0 = Next(0.0F, 1.0F);
        float float1 = Next(0.0F, 0.6F);
        float float2 = Next(0.0F, 0.9F);
        Color color = Color.HSBtoRGB(float0, float1, float2);
        return new ImmutableColor(color);
    }
}
